import this
from typing import List


def findMin(self, nums: List[int]) -> int:
    left, right = 0, len(nums)-1

    if len(nums) == 1:
        return nums[0]
    elif len(nums) == 2:
        return min(nums[0], nums[1])
    else:
        while left < right:
            mid = left + (right-left) // 2
            if nums[mid] < nums[right]:
                right = mid
            else:
                left = mid + 1
        return nums[left]


arr = [2,3,4,5,1]
print(findMin(this, arr))
